#!/bin/sh

# This optional part of suptime.sh script. Use it with suptimed.sh script.
# Link this file to proper rc*.d directories, to have it started/stopped automatically each time your system starts/power offs.
# Example:
# ln -s /etc/init.d/suptime /etc/rc5.d/S99suptime	- start script on boot
# ln -s /etc/init.d/suptime /etc/rc6.d/K99suptime	- stop script on shutdown (and upload shutdown image)
# Or add system service start/stop with your distro services manager.
# In Gentoo linux simply type `rc-update add default suptime` command to add SupTime script to startup.

# Change script directory and user which will run script (cannot be root!).
# Do not put slash at the end of directory.
DIR=/home/sufixx/progs/suptime/current
USER=user

case "$1" in
  start)
        su -c "$DIR/suptimed.sh" $USER > /dev/null &
        ;;
  stop)
        su -c "$DIR/suptime.sh -s" $USER
        ;;
  *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac

